<?php
/**
 * 公共常量定义
 */
const PAGE_SIZE = 10;
const THEME_NAME = 'basic';
const SECRET_KEY = 'ChisWill';

const WX_APPID = 'wx781492e97ff37a4f';
const WX_MCHID = '1408477002';
const WX_KEY = 'VKcJg2LUnnRPjmYtPX3Tfm8vqradppF9';
const WX_APPSECRET = '469a258ea26b7c7dd344edad37bfdcce';
const WX_TOKEN = 'jgZBoGWXMKzwixhJ';

const HX_ID = '182017';
const HX_TID = '1820170015';
const HX_MERCERT = 'yAhvTKEWKupquqvvkcVN0AwhKzEoo6MA0xDT7t0okTmQ4fXB3wRN85HLE55pV10ROlALRJEWRTJESMd10zglSQYmRMMWeg2v3LbPpA0oOXzMaD5RL2STrD6FtZq5dOnY';
const HX_RETURN_URL = '';// 如果不设置，表示支付完成后，回到当前域名的主页
const HX_NOTIFY_URL = '';// 如果不设置，表示支付完成后，异步通知将访问当前域名的`site/notify`
const ZH_PAY_DOMAIN = 'http://pay.gtdix.cn';

// 智慧APPID 
const ZH_APPID = '66927150148';
const ZH_APPSECRET = '14a0e4b1cd4035d1fb3ee1b131b8d1f9';

// 海马付APPID 
const HM_APPID = '2017120196763437';
const HM_APPSECRET = 'vxMpORLhGH8nBC9We2kFZErVPis1KtAq';


// 智付-微付
const Z_MERCHANT = '108888000072'; // 商家号

// 平安支付
const PINGAN_OPEN_ID = "87817bbf2e30ae4f20a4a6b01488618f";
const PINGAN_OPEN_KEY = "7fc03a9d3f6cfeae73c84a00ec3baef4";
const PINGAN_PAY_URL = "https://api.orangebank.com.cn/mct1/payorder";
const PINGAN_WX_PMTTAG = "Weixin"; // Weixin // WeixinBERL
const PINGAN_ALI_PMTTAG = "AlipayPAZH"; // AlipayPAZH // AlipayCS
// https://api.orangebank.com.cn/mct1/payorder
// https://mixpayuat4.orangebank.com.cn/mct1/payorder

// 艾特支付
const AITE_MEMBER_ID = "10329";
const AITE_MD5_KEY = "oyd7b53weilp66gbgz94c5nngkzjr5";
const AITE_REQUEST_URL = "http://www.aitepay.com/Pay_Index.html";

// 中安
//const YIFU_CUST_ID = "10176"; //商户号
//const YIFU_CUST_KEY = "2f1291815c5140f2aeedcc02b52bb37e"; //商户密钥
const YIFU_CUST_ID = "10893";
const YIFU_CUST_KEY= "b7d04be76648bbf1e097b43a2e4570adb970648c";
const YIFU_PAY_URL = "http://pay.y3y.com.cn/apisubmit";
const YIFU_QQ_NATIVE = "pay.qq.native"; //QQ扫码支付通道
const YIFU_WX_NATIVE = "pay.weixin.native"; //微信扫码支付通道
const YIFU_YL_NATIVE = "pay.ylsm.native"; //银联扫码支付通道
const YIFU_NET_NATIVE = "pay.net.native"; //网银快捷支付通道
const YIFU_WX_H5 = "pay.h5.weixin"; //微信H5支付通道
const YIFU_QQ_H5 = "pay.h5.qq"; //QQ H5支付通道
const YIFU_QR_URL = "http://47.52.167.242/payinterface/smpay"; //扫码支付请求地址
const YIFU_NET_URL = "http://47.52.167.242/payinterface/netpay"; //网银快捷支付请求地址
const YIFU_H5_URL = "http://47.52.167.242/payinterface/h5/json"; //H5支付请求地址

// 汇隆
const HL_MER_NO = "1795";
const HL_MER_SECRET = "2a7b52e0740a4f17a0dee2da32d6c73f";
const HL_GATEWAY = "http://103.93.126.240/api/trade/pay";

const ATTR_CREATED_AT = 'created_at';
const ATTR_CREATED_BY = 'created_by';
const ATTR_UPDATED_AT = 'updated_at';
const ATTR_UPDATED_BY = 'updated_by';


/**
 * 路径别名定义
 */
Yii::setAlias('common', dirname(__DIR__));
Yii::setAlias('frontend', dirname(dirname(__DIR__)) . '/frontend');
Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('api', dirname(dirname(__DIR__)) . '/api');

require Yii::getAlias('@common/config/merchant.php');

/**
 * 引入自定义函数
 */
$files = common\helpers\FileHelper::findFiles(Yii::getAlias('@common/functions'), ['only' => ['suffix' => '*.php']]);
array_walk($files, function ($file) {
    require $file;
});
/**
 * 公共变量定义
 */
common\traits\ChisWill::$date = date('Y-m-d');
common\traits\ChisWill::$time = date('Y-m-d H:i:s');
/**
 * 绑定验证前事件，为每个使用`file`验证规则的字段自动绑定上传组件
 */
common\components\Event::on('common\components\ARModel', common\components\ARModel::EVENT_BEFORE_VALIDATE, function ($event) {
    foreach ($event->sender->rules() as $rule) {
        if ($rule[1] === 'file') {
            $fieldArr = (array) $rule[0];
            foreach ($fieldArr as $field) {
                $event->sender->setUploadedFile($field);
            }
        }
    }
});
/**
 * 日志组件的全局默认配置
 */
Yii::$container->set('yii\log\FileTarget', [
    'logVars' => [],
    'maxLogFiles' => 5,
    'maxFileSize' => 1024 * 5,
    'prefix' => ['common\models\Log', 'formatPrefix']
]);
Yii::$container->set('yii\log\DbTarget', [
    'logVars' => [],
    'prefix' => ['common\models\Log', 'formatPrefix']
]);
